#include <QColorDialog>
#include "colorlabel.h"

ColorLabel::ColorLabel(QWidget *parent , const char* name /* =0 */) 
: QFrame( parent )
{

}

void ColorLabel::paintEvent(QPaintEvent * event)
{
	QFrame::paintEvent(event);
	QPainter painter(this);
	painter.fillRect(contentsRect(), color);
	painter.end();
}


void ColorLabel::mousePressEvent( QMouseEvent *e )
{
	QColor c;
	c = QColorDialog::getColor(color, this);
	if(c.isValid()) {
		color = c;
		setColor(color);
		emit colorChanged(color);
	}
}



